<?php
namespace h;

/**
 * Description of menu
 *
 * @author YeFng
 */
class link {
    function ad_nav()
    {
        $a = \YF_f::initC('\c\link\ad\g')->m();
        $this->_ad_nav($a);
    }
    function _ad_nav($res, $pid=0)
    {
            foreach($res[$pid] as $v)
             {
                $a = arr_decode($v['arr']);
                $sub = $res[$v['id']];
				$open =  $a['target'] ? ' target="'. htmlq($a['target']) .'"' : ' target="main"';
				$css = $a['cssClass'] ? ' class="button_16 '.  htmlq($a['cssClass']) .'"' : ' class="button_16"';
                echo '<p>';
                echo '<a href="'. htmlq($v['url']) .'" '. $open .$css .'>'. htmlq($v['name']) .'</a>';
                if ($sub)
                    echo '<span class="cu-b ico-menu-down"></span>';
                echo '</p>';
                if ($sub){
                    echo '<div class="subTree none">';
                    $this->_ad_nav($res, $v['id']);
                    echo '</div>';
                }
             }
    }
}
